﻿using DongFangGuoKai.WMSPlatform.Domain.Models;
using MiniExcelLibs;
using Newtonsoft.Json;
using SqlSugar;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string connection1 = "Data Source=59.110.231.187;Initial Catalog=WMSPlatform;User ID=sa;Password=1qaz@WSX;Trust Server Certificate=True;";
            string connection2 = "Server= 10.10.1.38;Port=2003;User Id=DBO;Password=123456;Database=OSRDB;";

            using SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = connection2,
                DbType = DbType.Oscar,

                 
                IsAutoCloseConnection = true
            }, db => {

                db.Aop.OnLogExecuting = (sql, pars) =>
                {

                    //获取原生SQL推荐 5.1.4.63  性能OK
                    Console.WriteLine(UtilMethods.GetNativeSql(sql, pars));

                    //获取无参数化SQL 对性能有影响，特别大的SQL参数多的，调试使用
                    //Console.WriteLine(UtilMethods.GetSqlString(DbType.SqlServer,sql,pars))


                };
                 
                //注意多租户 有几个设置几个
                //db.GetConnection(i).Aop

            });


            var QUERY1 = Db.Queryable<t_AuditRecord>().ToList();
                Console.WriteLine(JsonConvert.SerializeObject(QUERY1)); 
        }


    }
}
